﻿using System;
using System.Windows.Forms;
using System.Threading;

namespace VNPT.UI
{
    static class Program
    {
        private static Mutex m_Mutex;
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            var CurrentAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            string VersionNumber = CurrentAssembly.GetName().Version.ToString();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DevExpress.Skins.SkinManager.AllowWindowGhosting=true;
            DevExpress.LookAndFeel.LookAndFeelHelper.ForceDefaultLookAndFeelChanged();

            DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Visual Studio 2013 Blue");
            AutoUpdater.AutoUpdater.Start("http://vietphanmem.net/AutoUpdate/VNPTDoiSoat/AutoUpdate.xml");

            bool createdNew;
            m_Mutex = new Mutex(true, "MyApplicationMutex", out createdNew);
            if (createdNew)
                Application.Run(new DoiSoat.fMain());
            else
                DevExpress.XtraEditors.XtraMessageBox.Show("Có một chương trình đang chạy trong máy, vui lòng kiểm tra lại!", "Thông báo!",
                  MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
    }
}
